package cn.edu.sasu.mapper;

import cn.edu.sasu.domain.entity.SysMenu;
import cn.edu.sasu.domain.vo.MenuListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 王尧
 * @since 2024-04-28
 */
@Mapper
public interface SysMenuMapper {

    /*查询逻辑未被删除的菜单*/
    List<SysMenu> findSysMenuList(@Param("deleteFlag") Integer deleteFlag, @Param("offset") Integer offset, @Param("rows") Integer rows);

    /*查询逻辑未被删除的菜单的数量*/
    Integer countSysMenu(Integer deleteFlagYes);


    /*菜单名称模糊查询*/
    List<SysMenu> searchSysMenuList(@Param("deleteFlag") Integer deleteFlag, @Param("offset") Integer offset, @Param("rows") Integer rows,@Param("menuName")  String menuName);
    /*菜单名称模糊查询结果数量*/
    Integer countSearchSysMenu(@Param("deleteFlagYes") Integer deleteFlagYes,@Param("menuName") String menuName);


    /*根据菜单名称查询菜单*/
    SysMenu findSysMenuByMenuName(String menuName);

    /*保存菜单信息*/
    void save(SysMenu menu);

    /*获取所有的菜单名称*/
    List<MenuListVO> getAllMenuNames();

    /*删除*/
    Integer updateSysMenuDeleteFlagByMenuId(@Param("menuId") Integer menuId,@Param("deleteFlagYes")Integer deleteFlagYes);

    /*批量删除*/
    Integer updateSysMenuDeleteFlagByMenuIds(@Param("menuIds") List<Integer> menuIds,@Param("deleteFlagYes")  Integer deleteFlagYes);


    Integer updateInfo(SysMenu menu);

    SysMenu findSysUserByUserId(Long menuId);
}
